<?php
header("content-type:text/html;charset=utf-8");
$id = $_POST['id'];
$name = isset($_POST['name'])?$_POST['name']:"";
$time = isset($_POST['time'])?$_POST['time']:"";
$num = isset($_POST['num'])?$_POST['num']:"";
$class = isset($_POST['class'])?$_POST['class']:"";
$pdo = new PDO("mysql:host=127.0.0.1;dbname=11-9;charset=utf8",'root','root');
$sql = "update excel set name='$name',time='$time',num='$num',class='$class' where id = '$id'";
$res = $pdo->exec($sql);
if($res){
    echo "<script>alert('修改成功');location.href='show.php'</script>";
}else{
    echo "<script>alert('修改失败');location.href='updata.php'</script>";
}
?>
